{$field}_pre
Filter HookDescription
Filters the value of a specific post field before saving. Only applied to post fields with a name which is *not* prefixed with `post_`. The dynamic portion of the hook name, `$field`, refers to the post field name. Possible filter names include: - `ID_pre` - `comment_status_pre` - `ping_status_pre` - `to_ping_pre` - `pinged_pre` - `guid_pre` - `menu_order_pre` - `comment_count_pre`Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3147 |
Hook Parameters
Type | Name | Description |
---|---|---|
mixed
|
$value
|
Value of the post field. |
Usage Examples
Basic Usage
<?php
// Hook into {$field}_pre
add_filter('{$field}_pre', 'my_custom_filter', 10, 1);
function my_custom_filter($value) {
// Your custom filtering logic here
return $value;
}
Source Code Context
wp-includes/post.php:3147
- How this hook is used in WordPress core
<?php
3142 *
3143 * @since 2.3.0
3144 *
3145 * @param mixed $value Value of the post field.
3146 */
3147 $value = apply_filters( "{$field}_pre", $value );
3148 }
3149 } else {
3150
3151 // Use display filters by default.
3152 if ( $prefixed ) {
PHP Documentation
<?php
/**
* Filters the value of a specific post field before saving.
*
* Only applied to post fields with a name which is *not* prefixed with `post_`.
*
* The dynamic portion of the hook name, `$field`, refers to the post
* field name. Possible filter names include:
*
* - `ID_pre`
* - `comment_status_pre`
* - `ping_status_pre`
* - `to_ping_pre`
* - `pinged_pre`
* - `guid_pre`
* - `menu_order_pre`
* - `comment_count_pre`
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.